package com.example.springcloudnacosconfig.util;

import java.util.concurrent.*;

public class ThreadPool {

    private static int produceTaskSleepTime = 2;
    private static int produceTaskMaxNumber = 10;



    public static void main(String[] args) {
        // 构造一个线程池
        ThreadPoolExecutor threadPool = new ThreadPoolExecutor(10, 20, 3, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(3),
                new ThreadPoolExecutor.DiscardOldestPolicy());
        int index=0;
        while (true) {
            //if(index>2) break;
            threadPool.execute(new Runnable() {
                @Override
                public void run() {
                    String  url="http://localhost:9000/testC";
                    String  st= HttpUtil.sendGet(url,null);
                    System.out.println(st);
                }
            });
            index++;
        }
    }
}
